#ifndef QUATERNION_H
#define QUATERNION_H

#include "GeoTool_global.h"

#include "vec4.h"
#include "Matrix.h"

/*! @brief A quaternion is a mathematical tool, using non real dimension, to create a valid rotation Matrix
 *  A quaternion is divided in 2 part :  A scalar, w, and a vector : x,y,z
 *
 *  In 3D, the vector part represent the axis direction of a rotation, and the scalar the angle value
 */

class GEOTOOLSHARED_EXPORT Quaternion
{
    public:

    /********************************************/
    /*              Members                     */
    /********************************************/

        /********************************************/
        /*              Properties                  */
        /********************************************/

            float a,b,c,d;

        /********************************************/
        /*              Constructors                */
        /********************************************/

            Quaternion();
            Quaternion(float aa, float bb, float cc, float dd);

        /********************************************/
        /*              Methods                     */
        /********************************************/

            /*! @brief Return a rotation matrix from the current Quaternion */
            float * RotationMatrix();

            /*! @brief Return the Quaternion Magnitude              */
            float Magnitude();

            /*! @brief Normalize the current Quaternion             */
            void Normalize();

            /*! @brief Return the Quaternion normalized, without applying the operation on the current quaternion   */
            Quaternion & Normalized();

            /*! @brief Return the Conjuge of the current Quaternion */
            Quaternion & Conjuge();

            /*! @brief Convenient function to check Quaternion content in the console   */
            void Print();


        /********************************************/
        /*          Operator Overload               */
        /********************************************/

            Quaternion & operator*(const Quaternion &);

    /********************************************/
    /*              Static                      */
    /********************************************/

        /********************************************/
        /*              Properties                  */
        /********************************************/

        /********************************************/
        /*              Methods                     */
        /********************************************/

            /*! @brief Return the quaternion corresponding to euler rotation    */
            static Quaternion & Euler(float x, float y, float z);

};

#endif // QUATERNION_H
